from ftplib import FTP

ftp = FTP()
timeout = 30
port = 2121
ftp.connect('192.168.2.102', port, timeout)
ftp.login('li', '123')  # Login
print(ftp.getwelcome())

ftp.cwd('/')

list = ftp.nlst()
for name in list:
    print(name)

filename = input('你要下载的文件')

path = 'D:/ftp保存/' + name
_f = open(path, 'wb')
ftp.retrbinary(filename, _f.write)
ftp.delete(name)


